import urllib.request as req


def download(url):
    try:
        html = req.urlopen(url).read().decode('utf-8')
        return html
    except Exception as e:
        print('error',e)


if __name__ == '__main__':
    h = download('http://www.baidu.com')
    print(h)